package com.yq.design.factory.simple;

/**
 * @ClassName Factory
 * @Description 简单工厂模式,工厂只需要根据传入的type，匹配对应的具体产品，抽象Phone有make，xiaomi和apple分别实现make就行
 * @Author yaoqiang
 * @Date 2021/3/9 11:29
 * @Version 1.0
 */
public class Factory {
    public Phone makePhone(String phoneType) {
        if (phoneType.equalsIgnoreCase("xiaomi")){
            return new Xiaomi();
        }else if (phoneType.equalsIgnoreCase("apple")){
            return  new Apple();
        }
        return null;
    }
}
